package cn.piaoyi.service.imp;


import java.util.*;
import org.apache.commons.logging.*;
import cn.piaoyi.bean.City;
import cn.piaoyi.bean.Province;
import cn.piaoyi.dao.CityDAO;
import cn.piaoyi.dao.ProvinceDAO;
import cn.piaoyi.service.CityService;


public class CityServiceImp implements CityService {

	private static final Log logger = LogFactory.getLog(CityServiceImp.class);
	
	private CityDAO cityDAO;
	private ProvinceDAO provinceDAO;
	
	public CityDAO getCityDAO() {
		return cityDAO;
	}

	public void setCityDAO(CityDAO cityDAO) {
		this.cityDAO = cityDAO;
	}

	public ProvinceDAO getProvinceDAO() {
		return provinceDAO;
	}

	public void setProvinceDAO(ProvinceDAO provinceDAO) {
		this.provinceDAO = provinceDAO;
	}

	/**
	 * @param id
	 * @return Province
	 * 根据ID查找Province
	 */
	public Province findProvinceById(long id){
		return this.getProvinceDAO().findProvinceById(id);
	}
	
	/**
	 * @param name
	 * @return Province
	 * 根据name查找Province
	 */
	public Province findProvinceByName(String name){
		return this.getProvinceDAO().findProvinceByName(name);
	}
	
	/**
	 * @return List
	 * 获取所有Province
	 */
	public List findProvinceAll() {
		return this.getProvinceDAO().findProvinceAll();
	}
	
	/**
	 * @param id
	 * @return City
	 * 根据ID获取City
	 */
	public City findCityById(long id){
		return this.getCityDAO().findCityById(id);
	}
	
	/**
	 * @param provinceId
	 * @return List
	 * 根据provinceId获取City列表
	 */
	public List findCitysByProvinceId(long provinceId) {
		return this.getCityDAO().findCitysByProvinceId(provinceId);
	}
	
	/**
	 * @param provinceId
	 * @param name
	 * @return List
	 * 根据provinceId获取City列表
	 */
	public City findCitysByProvinceIdName(long provinceId,String name){
		return this.getCityDAO().findCitysByProvinceIdName(provinceId, name);
	}
	
	
	/**
	 * @return List
	 * 获取所有City列表
	 */
	public List findCityAll() {
		return this.getCityDAO().findCityAll();
	}
}
